package day_2022_7_to_8.day48;

import java.util.Arrays;

/**
 * 287. 寻找重复数
 * @author haomin
 * @date 2022/07/20 12:53
 **/
public class Day5_2_Num287_FindDuplicate {
    class Solution {
        public int findDuplicate(int[] nums) {
            Arrays.sort(nums);
            int fast = 0;
            int slow = 1;
            while(true){
                if(nums[fast] == nums[slow]){
                    return nums[fast];
                }
                fast++;
                slow++;
            }
        }
    }
}